﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ThomasGIS.Network
{
    public class DirectedNetwork : Network, IDirectedNetwork
    {
        public int InDegree(int nodeIndex)
        {
            int nodeID = this.NodeList[nodeIndex].GetID();
            IEnumerable<INetworkArc> linkArcs = this.ArcList.Where(oneArc => oneArc.GetEndNodeID() == nodeID);
            return linkArcs.Count();
        }

        public int OutDegree(int nodeIndex)
        {
            int nodeID = this.NodeList[nodeIndex].GetID();
            IEnumerable<INetworkArc> linkArcs = this.ArcList.Where(oneArc => oneArc.GetStartNodeID() == nodeID);
            return linkArcs.Count();
        }
    }
}
